[Coding036] LeetCode 83

Remove Duplicates from Sorted List

Ben 2024.03.27

More coding records

Get the knowledge flowing and circulating! :)

目录

本题收获

image-20240327182845241

题目:83. Remove Duplicates from Sorted List

Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.

Example 1:

img

Example 2:

img

Constraints:


代码1

代码解读 | 评价

  • 特殊情况需要特别注意!

复杂度分析

image-20240327182534095

代码2

比代码1看上去更清爽。